#-------------------------------------------------------------------
# This file is part of the CMake build system for MPG
#     (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.MPG3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------

#######################################################################
# Find all necessary and optional MPG dependencies
#######################################################################

# Find Boost
# Prefer static linking in all cases

if (WIN32 OR APPLE)
	set(Boost_USE_STATIC_LIBS TRUE)
else ()
	# Statically linking boost to a dynamic MPG build doesn't work on Linux 64bit
	set(Boost_USE_STATIC_LIBS ${MPG_STATIC})
endif ()
set(Boost_ADDITIONAL_VERSIONS "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" "1.40.0" "1.40")
# Components that need linking (NB does not include header-only components like bind)
set(MPG_BOOST_COMPONENTS thread date_time)
find_package(Boost COMPONENTS ${MPG_BOOST_COMPONENTS} QUIET)

if (NOT Boost_FOUND)
	# Try again with the other type of libs
	set(Boost_USE_STATIC_LIBS NOT ${Boost_USE_STATIC_LIBS})
	find_package(Boost COMPONENTS ${MPG_BOOST_COMPONENTS} QUIET)
endif()

find_package(Boost QUIET)
# Optional Boost libs (Boost_${COMPONENT}_FOUND
macro_log_feature(Boost_FOUND "boost" "Boost (general)" "http://boost.org" FALSE "" "")
macro_log_feature(Boost_THREAD_FOUND "boost-thread" "Used for threading support" "http://boost.org" FALSE "" "")
macro_log_feature(Boost_DATE_TIME_FOUND "boost-date_time" "Used for threading support" "http://boost.org" FALSE "" "")


# Display results, terminate if anything required is missing
MACRO_DISPLAY_FEATURE_LOG()

if (Boost_FOUND)
  include_directories(${Boost_INCLUDE_DIRS})
  link_directories(${Boost_LIBRARY_DIRS})
endif ()

# Find OIS
find_package(OIS)
macro_log_feature(OIS_FOUND "OIS" "Input library" "http://sourceforge.net/projects/wgois" FALSE "" "")

# Find Ogre
find_package(OGRE)
macro_log_feature(OGRE_FOUND "Ogre" "Rendering library" "http://www.ogre3d.org" FALSE "" "")

# Find CEGUI
find_package(CEGUI)
macro_log_feature(CEGUI_FOUND "CEGUI" "menu library" "http://www.cegui.co.uk" FALSE "" "")

# Find MySQL
find_package(MYSQL)
macro_log_feature(CEGUI_FOUND "CEGUI" "menu library" "http://www.cegui.co.uk" FALSE "" "")
